package com.zl.tby.vo.exp;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.zl.tby.model.TbyMountainPeak;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 山峰信息bean
 * @author changpeng
 * @version 1.0
 * @since 2024/8/6 20:12
 */
@Data
public class TbyMountainPeakExportExcel {

    /**山峰名称*/
    @ExcelProperty(value = "山峰名称", index = 0)
    @ColumnWidth(15)
    private String name;
    /**经度*/
    @ExcelProperty(value = "经度", index = 1)
    @ColumnWidth(15)
    private String longitude;
    /**纬度*/
    @ExcelProperty(value = "纬度", index = 2)
    @ColumnWidth(15)
    private String latitude;
    /**山峰位置*/
    @ExcelProperty(value = "山峰位置", index = 3)
    @ColumnWidth(15)
    private String position;
    /**山峰高度*/
    @ExcelProperty(value = "山峰高度", index = 4)
    @ColumnWidth(15)
    private BigDecimal height;
    /**山峰简介*/
    @ExcelProperty(value = "山峰简介", index = 5)
    @ColumnWidth(15)
    private String content;

    public static List<TbyMountainPeakExportExcel> createList(List<TbyMountainPeak> dbList) {
        List<TbyMountainPeakExportExcel> list = new ArrayList<>();
        dbList.forEach(item -> {
            TbyMountainPeakExportExcel excel = new TbyMountainPeakExportExcel();
            excel.setName(item.getName());
            excel.setLongitude(item.getLongitude());
            excel.setLatitude(item.getLatitude());
            excel.setPosition(item.getPosition());
            excel.setHeight(item.getHeight());
            excel.setContent(item.getContent());
            list.add(excel);
        });
        return list;
    }
}
